package lol.clann.minecraft.springboot.plugin.bukkit.command.resolver.factory;

import lol.clann.minecraft.springboot.api.bukkit.command.resolver.CommandResolver;
import lol.clann.minecraft.springboot.api.bukkit.command.resolver.CommandResolverFactory;
import org.springframework.stereotype.Component;

/**
 *
 * @author pyz
 * @date 2019/5/6 9:29 PM
 */
@Component
public class CharacterCommandResolverFactory implements CommandResolverFactory {
    @Override
    public boolean canResolve(Class<?> type) {
        return Character.TYPE == type || Character.class.isAssignableFrom(type);
    }

    @Override
    public CommandResolver getResolver(Class<?> clazz) {
        return (sender, arg, type) -> arg.charAt(0);
    }
}
